﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace NetworkIndexer.Data.Repositories.Concrete
{
    public class FileSystemDataAccess : IFileSystemDataAccess
    {
        /// <summary>
        /// Gets the files for a given path
        /// </summary>
        /// <param name="path"></param>
        /// <param name="searchExtensions"></param>
        /// <returns></returns>
        public IEnumerable<string> GetFiles(string path, string searchExtensions)
        {
            return Directory.GetFiles(path, "*.*", SearchOption.AllDirectories)
                               .Where(file => searchExtensions.Contains(Path.GetExtension(file)));
        }
    }
}
